/*
 * @Author: dvlproad
 * @Date: 2023-10-12 18:19:47
 * @LastEditors: dvlproad
 * @LastEditTime: 2023-10-31 19:18:00
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'ts_shared_webview_container.dart';
import 'ts_shared_webview_notifier.dart';

class TSWebAddToDiffPage extends StatefulWidget {
  @override
  _TSWebAddToDiffPageState createState() => _TSWebAddToDiffPageState();
}

class _TSWebAddToDiffPageState extends State<TSWebAddToDiffPage> {
  int currentPageIndex = 0;

  @override
  void initState() {
    super.initState();
    currentPageIndex = 0;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('第${currentPageIndex + 1}页'),
      ),
      body: _bodyWidget,
    );
  }

  Widget get _bodyWidget {
    return Container(
      color: const Color.fromRGBO(245, 245, 245, 1.0),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          ElevatedButton(
            onPressed: goNext,
            child: const Text('进入下一页3'),
          ),
          _normalViewContainer,
        ],
      ),
    );
  }

  Widget get _normalViewContainer {
    return const TSSharedWebViewContainer();
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => TSSharedWebViewContainerModel()),
      ],
      child: const TSSharedWebViewContainer(),
    );
  }

  void goNext() {
    setState(() {
      currentPageIndex++;
    });
    Navigator.push(
      context,
      MaterialPageRoute(
        builder: (_) => TSWebAddToDiffPage(),
      ),
    );
  }
}
